package cn.tjnext.apply.repositories;

import cn.tjnext.apply.entity.ApplicantEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by cp on 2017/8/4.
 */
@Repository
public interface ApplicantRepository extends AbstractRepository<ApplicantEntity> {

    Page<ApplicantEntity> findByUser_NameLikeAndStatus(String keyWord, int success, Pageable pageable);

    Page<ApplicantEntity> findByStatus(int normal, Pageable newPageable);

    List<ApplicantEntity> findByUser_pkIdAndStatus(Long userId, int normal);

    @Query("select a from ApplicantEntity a where a.status = ?1 order by a.createTime desc ")
    List<ApplicantEntity> findAllByStatus(int normal);

    List<ApplicantEntity> findByOrderId(Long orderId);
}
